#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

//int main()
//{
//	int a = 111;
//	short b = 2;
//	b = a + 2;
//	printf("%d", b);
//
//	return 0;
//}


#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>



struct Stu
{
	char name[20];
	size_t age;

}stu1, stu2, stu3;


int cmp_sturct(const void* p1, const void* p2)
{

	return strcmp((struct Stu*)p1, (struct Stu*)p2);

}



int cmp_int(const void* p1, const void* p2)
{
	return (*(int*)p1) - (*(int*)p2);
}






void swap(char* p1, char* p2,size_t with)
{
	for (int i = 0; i < with; i++)
	{
		char tem = *p1;
		*p1 = *p2;
		*p2 = *p1;
		*p1++;
		*p2++;
	}


}


void print_arr(int arr[], size_t sz)
{
	for (int i = 0; i < sz; i++)
	{
		printf("%d ", arr[i]);
	}


}
  



void My_sqort(void* base, size_t sz, size_t with, int (*cmp)(void* p1, void* p2))
{
	int i, j;
	for (i = 0; i < sz - 1; i++)
	{
		for (j = 0; j < sz - 1 - i; j++)
		{
			if (cmp((char*)base + j * with, (char*)base + (j+1) * with )>0)
			{
				swap((char*)base + j * with, (char*)base + (j + 1) * with,with);


			}
		}
	}





}


